<template>
  <div class="myume fixt mytoch" @touchmove.prevent>
    <div class="mymumeheader">填写完整版请登录PC端樟树市人才服务</div>
    <van-divider style="color:#323233" />
    <div>
      <div v-for="(item,index) in list" :key="index+'myresume'">
        <div class="zwlb">
          <ul>
            <li>
              <div class="zwlbnr">
                <p class="zwlbbt">
                  {{item.title}}
                  <span class="jlwcbfb">{{item.mobileIntegrity}}%</span>
                </p>
                <p>
                  <span class="myjlbtnl">{{item.publicity===1?"完全公开":"完全保密"}}</span>
                  <span class="myjlbtnr" v-if="item.express">{{item.express?"快速投递":""}}</span>
                </p>
                <p>
                  <span>浏览：{{item.viewCount}}</span>
                  <span class="zwfg">|</span>
                  <span>下载：{{item.downloadCount}}</span>
                </p>
              </div>

              <!-- <van-divider style="color:#323233" /> -->
            </li>
          </ul>
          <div>
            <button class="myresumedel" @click="resumedel(item.id)">删除</button>
            <button class="myresumerenove" @click="selectEdit(item.id)">编辑</button>
          </div>
        </div>
      </div>

      <button class="myresumeadd" style="position: fixed;bottom: 1.5rem;right: 0.5rem;" v-if="list.length<3"
        @click="addResume">新建简历</button>
    </div>
  </div>
</template>
<script>
import RESUMEMANAGEMENT from '@/api/ResumeManagement'
export default {
  data () {
    return {
      zw: '',
      list: []
    }
  },
  computed: {},
  methods: {
    addResume () {
      this.$router.push({
        name: 'resumeRemove'
      })
    },
    // 简历列表
    selectResumeList () {
      let that = this
      RESUMEMANAGEMENT.selectResumeList().then(res => {
        console.log(res.data)
        if (res.data.code === 200) {
          that.list = res.data.data
        }
      })
    },
    // 简历编辑
    selectEdit (id) {
      this.$router.push({
        name: 'resumeRemove',
        query: {
          resumeid: id,
          vlaue: 2
        }
      })
    },
    // 简历删除
    resumedel (id) {
      let that = this
      if (this.list.length === 1) {
        that.$notify('对不起，您需要保留一份简历')
        return false
      }
      this.$dialog
        .confirm({
          title: '简历删除',
          message: '是否删除简历',
          lockScroll: true,
          closeOnPopstate: true
        })
        .then(() => {
          // let params = {
          //   id: id
          // };
          RESUMEMANAGEMENT.deleteById(id).then(res => {
            console.log(res.data)
            if (res.data.code === 200) {
              this.selectResumeList()
            }
          })
        })
        .catch(() => {
          // on cancel
        })
    }
  },
  created () {
    this.selectResumeList()
  }
}
</script>
<style scoped>
.mymumeheader {
  /* height: 1rem;
  line-height: 1rem; */
  color: rgba(24, 147, 252, 1);
}
.mytoch {
  touch-action: none;
}
</style>
